home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / peekpoke.zip / PEEKPOKE.003
Text File  |  1985-08-24  |  14KB  |  328 lines

  1.  
  2. ----------------------------------------------------------------------------
  3. ----------------------------------------------------------------------------
  4. ----                                                                    ----
  5. ----     █▀▀▀▄ █▀▀▀▀ █▀▀▀▀ █   █     ▄     █▀▀▀▄ ▄█▀█▄ █   █ █▀▀▀▀      ----
  6. ----     █▄▄▄▀ █▄▄▄  █▄▄▄  █▄▄▀    ▄▄█▄▄   █▄▄▄▀ █   █ █▄▄▀  █▄▄▄       ----
  7. ----     █     █     █     █  ▀▄     █     █     █   █ █  ▀▄ █          ----
  8. ----     █     █▄▄▄▄ █▄▄▄▄ █   █           █     ▀█▄█▀ █   █ █▄▄▄▄      ----
  9. ----                                                                    ----
  10. ----                   ▄▀▀▀▄ █   █ ▄▀▀▀▄ █▀▀▀▄ ▀▀▀█▀▀▀                  ----
  11. ----                   █     █▄▄▄█ █▄▄▄█ █▄▄▄▀    █                     ----
  12. ----                   █     █   █ █   █ █   █    █                     ----
  13. ----                   ▀▄▄▄▀ █   █ █   █ █   █▌   █                     ----
  14. ----                                                                    ----
  15. ----           ▄▄▄▄▄  ▄▄▄▄   ▄▄▄▄▄▄▄           ▄▄▄▄    ▄▄▄              ----
  16. ----     FOR     █    █   █  █  █  █           █   █  █   ▀             ----
  17. ----             █    █▀▀▀▄  █     █   ▀▀▀▀▀   █▀▀▀   █                 ----
  18. ----     THE   ▄▄█▄▄  █▄▄▄▀  █     █           █      ▀▄▄▄▀             ----
  19. ----                                                                    ----
  20. ----                                                                    ----
  21. ----------------------------------------------------------------------------
  22. ----------------------------------------------------------------------------
  23.  
  24.             This Document has been created for the Universal use
  25.           of all IBM-PC and PC compatible systems, and encourages
  26.           all users to participate in it's spirit by appending this
  27.           document with any additional material that may be useful
  28.           to other users. 
  29.  
  30.              It is requested that donators submit peeks and pokes
  31.           to be used in IBM BASIC(A) Version 2.00. If the peeks
  32.           and pokes do not function in ALL current versions of DOS,
  33.           please state which versions it DOES work in. It is also
  34.           asked that donors keep the same format as has been initiated
  35.           with the original submissions.
  36.  
  37.              Donators to Peeks and Pokes assume NO responsibility
  38.           for their submissions....Use on your own judgement.
  39.  
  40.  
  41. -------------------------------------------------------------------
  42. KEYBOARD BUFFER                         Jeff Askew  1/16/84
  43. ---------------
  44.  
  45.         DEF SEG=0: POKE 1050 , PEEK(1052): DEF SEG
  46.  
  47.         This clears the DOS system keyboard buffer.
  48.         Works very well in compiled Basic.
  49.  
  50. -------------------------------------------------------------------
  51. MONITORS                                Jeff Askew  1/16/84
  52. --------
  53.  
  54.         ADDRESS = &HB000  '--- &HB800 to test for color monitor
  55.         DEF SEG = ADDRESS: POKE 1,16
  56.         IF PEEK(1) = 16 THEN MONOCHROME = TRUE    '--- or COLOR=TRUE
  57.  
  58.         This is one simple way to see which monitors are connected.
  59.         If ADDRESS = &HB800 (for color), then substitute COLOR=TRUE
  60.         for MONOCHRONE=TRUE.
  61.  
  62. -------------------------------------------------------------------
  63. ACTIVE MONITOR                          Jeff Askew  1/16/84
  64. --------------
  65.  
  66.         DEF SEG=0: IF (PEEK(1040) AND 48) = 48  THEN MONO.ACTIVE = TRUE
  67.            ELSE COLOR.ACTIVE = TRUE
  68.  
  69.         This determines which monitor is active at the time.
  70.  
  71. -------------------------------------------------------------------
  72. MONITOR WIDTH                           Jeff Askew  1/16/84
  73. -------------
  74.  
  75.         SCREEN 0,0,0,0: WIDTH 40: CLS
  76.         OUT 948,2: OUT 949,62
  77.  
  78.         This changes the screen dimensions to 40 column width,
  79.         but centers the screen in the middle of the monitor.
  80.         ALL of the commands above must be executed before the
  81.         OUT's even if that is the current video mode set, otherwise
  82.         strange things happen.
  83.  
  84. -------------------------------------------------------------------
  85. MORE COLORS                             Jeff Askew  1/16/84
  86. -----------
  87.  
  88.         OUT &H3D8,9  '--- in 80x25 color mode
  89.         OUT &H3D8,8  '--- in 40x25 color mode
  90.  
  91.         This will disable blinking mode, but enable extended
  92.         background colors in text mode. The full 16 colors
  93.         will then be available for the background, not just
  94.         the usual 8.
  95.  
  96. -------------------------------------------------------------------
  97. MONITOR PORTS                           Jeff Askew  2/23/84
  98. -------------
  99.                          ----- Monochrome ----
  100.  
  101.                  OUT 952,1       'Disable Monochrome display
  102.                  OUT 952,15      'Disable Mono Bilnk
  103.                  OUT 952,255     'Normal Mono Pattern
  104.  
  105.         --- 80 x 25 Color ---                --- 40 x 25 Color ---  
  106.                                   
  107.       OUT 984,1   'Disable Display         OUT 984,0   'Disable Display
  108.       OUT 984,9   'Disable Blink           OUT 984,8   'Disable Blink
  109.       OUT 984,41  'Normal Pattern          OUT 984,40  'Normal Pattern
  110.                                   
  111.          --- 80 x 25 B&W ---                  --- 40 x 25 B&W ---    
  112.                                   
  113.       OUT 984,5   'Disable Display         OUT 984,4   'Disable Display
  114.       OUT 984,13  'Disable Blink           OUT 984,12  'Disable Blink
  115.       OUT 984,45  'Normal Pattern          OUT 984,44  'Normal Pattern
  116.                                   
  117.                                   
  118.         These OUT's are neat little tricks, and can be quite useful.
  119.         For example: Disable the color monitor's display while doing
  120.         the initial drawings for graphics GET statements. This way,
  121.         the shapes will not flash up on the screen. Not earthshaking
  122.         but it adds a touch of class to the program.
  123.  
  124. -------------------------------------------------------------------
  125. SCREEN DIMENSIONS                       Jeff Askew  1/16/84
  126. -----------------
  127.  
  128.         POKE 91,xx      '---  Top row
  129.         POKE 92,xx      '---  Bottom row
  130.         POKE 41,xx      '---  Right column
  131.  
  132.         These locations store the boundries for Basic's scrolling.
  133.         By changing these values from the defaults, you may alter
  134.         the window that the Basic editor scrolls up. This is a
  135.         most interesting set with many potential uses.
  136.  
  137. -------------------------------------------------------------------
  138. SYSTEM CONFIGURATION                    Jeff Askew  1/16/84
  139. --------------------
  140.         [ DEF SEG=0 ]
  141.  
  142.         LOCATION 1040:  DDVV RRXI       ( Bit-Mapped. )
  143.                         DD = Number of Disk drives -1.
  144.                         VV = Current video mode:
  145.                              1 - 40x25 with color/graphics card.
  146.                              2 - 80x25 with c/g card.
  147.                              3 - 80x25 with Monochrome card.
  148.                         RR = Ram installed on the motherboard.
  149.                              0/16k, 1/32k, 2/48k, 3/64k
  150.                         X  = Unused.
  151.                         I  = 0 if no disk drives on system,
  152.                              1 if disk drive(s) are present.
  153.  
  154.         LOCATION 1041:  PPXG CCCX
  155.                         PP  = Number of printer adapters.
  156.                         X   = Unused.
  157.                         G   = Number of game adapters.
  158.                         CCC = Number of RS232-C adapters.
  159.  
  160. -------------------------------------------------------------------
  161. KEYBOARD STATUS                         Jeff Askew  1/16/84
  162. ---------------
  163.         [ DEF SEG=0 ]
  164.  
  165.         LOCATION 1047:  ICNS AXLR         ( Bit-Mapped. )
  166.                         I = Insert state (1/0).
  167.                         C = Caps-Lock state.
  168.                         N = Num-Lock state.
  169.                         S = Scroll-Lock state.
  170.                         A = Alt-Shift being pressed.
  171.                         X = Ctrl-Shift being pressed.
  172.                         L = Left shift being pressed.
  173.                         R = Right shift being pressed.
  174.                             
  175.         LOCATION 1048:  ICNS XXXX
  176.                         I = Insert being pressed.
  177.                         C = Caps-Lock being pressed.
  178.                         N = Num-Lock being pressed.
  179.                         S = Scroll-Lock being pressed.
  180.  
  181.         These are very uesful ways to fully control the keyboard
  182.         input. All bits are either on(1) or off(0).
  183.  
  184. -------------------------------------------------------------------
  185. KEYBOARD                                Jeff Askew  2/23/84
  186. --------
  187.  
  188.         OUT 97,204      'disables
  189.         OUT 97,76       'enables
  190.  
  191.         These port patterns can be used to easily disable the
  192.         keyboard interrupts. When the keyboard is disabled or
  193.         'Locked-up', any key struck is totally ignored. It will
  194.         NOT go into the buffer or be processed. Just be sure 
  195.         that your test program enables it again before ending,
  196.         or you will have to do a hard-IPL!!!
  197. -------------------------------------------------------------------
  198. DISK                                    Jeff Askew  2/23/84
  199. ----
  200.       [ DEF SEG = 64 ]
  201.  
  202.         T=PEEK(69)          'Current Track Number
  203.         H=PEEK(70)          'Current Head Number
  204.         S=PEEK(71)          'Current Sector Number
  205.         B=(128*2^PEEK(72))  'Number of Bytes per Sector
  206.  
  207.         This set of addresses is very useful for determining
  208.         what version DOS is being used and the current location
  209.         of the Read/Write heads.
  210.  
  211. -------------------------------------------------------------------
  212. PROTECTION                              Jeff Askew  2/23/84
  213. ----------
  214.       [ DEF SEG ]
  215.  
  216.         POKE 1124,255   'Protects program in memory
  217.         POKE 1124,0     'Un-Protects program
  218.  
  219.         This can enable you to protect or un-protect a BASIC
  220.         program just like saving it with the ',P' argument to
  221.         the SAVE command. An important point to be aware of is
  222.         that when you POKE 1124,255 to protect the program, this
  223.         also blocks out any subsequent POKE statements, and also
  224.         will not allow you to alter the program in any way!!
  225.  
  226. -------------------------------------------------------------------
  227. MISC                                    Jeff Askew  2/23/84
  228. ----       [ DEF SEG ]
  229.  
  230.           LOCATION (hex)    PURPOSE
  231.            ----------   ----------------
  232.             2E &  2F    Line number of the current line being executed.
  233.            258 & 259    Offset of start of program variables.
  234.             30 &  31    Offset of start of program text.
  235.  
  236.         The most important of these three is the last one. Using
  237.         this location in DOS 2.00, one may successfully and con-
  238.         sistantly use the SHELL command (what shell command?!?!).
  239.         Use it as such, with the POKE statements IMMEDIATELY
  240.         following the SHELL command:
  241.           
  242.         DEF SEG : A=PEEK(30) : B=PEEK(31)
  243.         SHELL CHKDSK   '-- Invokes any DOS command
  244.         POKE 30,A : POKE 31,B
  245.  
  246. -------------------------------------------------------------------
  247. COM:                                    Jeff Askew  2/23/84
  248. ----
  249.  
  250.         ADDR = PEEK(com.num*2-2) + 256*(PEEK(com.num*2-1))
  251.         STATUS = PEEK(ADDR+6)
  252.  
  253.         The byte returned decodes as follows:
  254.  
  255.                           SRDC LTAB
  256.  
  257.     S = Received line signal detect     L = Delta receive line signal detect
  258.     R = Ring indicator                  T = Trailing edge ring indicator
  259.     D = Delta set ready                 A = Delta data set ready
  260.     C = Clear to send                   B = Delta clear to send
  261.  
  262.         This byte allows easy access and control of communications
  263.         activity and is especially useful in custom communications
  264.         software. ( 'com.num' above is the number of the com port:
  265.         i.e. Com1: = 1 , Com2: = 2 , etc...)
  266.  
  267. -------------------------------------------------------------------
  268. BASIC INTERPRETER            Todd Hartle     2/4/84
  269. -----------------
  270.  
  271. [ DEF SEG ] 
  272.  
  273. PEEK(106) 'Number of characters in BASICS buffer
  274.  
  275. PEEK(839) + 256 * PEEK(840) 'Line number of last error
  276.  
  277. -------------------------------------------------------------------
  278. SPEAKER                    Todd Hartle    2/4/84
  279. -------
  280.    
  281. OUT 97,(INP(97) or 3) 'Turn speaker on
  282.  
  283. OUT 97,(INP(97) and 252) 'Turn speaker off
  284.  
  285. -------------------------------------------------------------------
  286. SWITCH DISPLAYS                Todd Hartle     2/4/84
  287. ---------------                             
  288.  
  289. [ DEF SEG=64 ]
  290.  
  291. CRT=(PEEK(16) and 48)/16
  292.  
  293. If CRT = 3 then switch to color else switch to monochrome.
  294.  
  295. POKE 16,(PEEK(16) or 48) 'Switch to mono 
  296.  
  297. POKE 16,(PEEK(16) and 207) or 16 'Switch to color
  298.  
  299. After using one of the POKES also use these lines:
  300. LOCATE ,,,7,7
  301. LOCATE 1,10
  302. SCREEN 0:WIDTH 40:WIDTH 80
  303.  
  304. INP(954) 'Check if mono is avaliable. Not avaliable if equals 255.
  305. INP(986) 'Check if color is avaliable. Not avaliable if equals 255.
  306.  
  307. -------------------------------------------------------------------
  308. MORE MISC.                Todd Hartle    2/4/84
  309. ---- -----
  310.  
  311. Click cassete port:
  312. OUT 97,68
  313. OUT 97,77
  314.  
  315. Note: Some kind of delay will need to be used inbetween the statements
  316. else sound will be very faint.(example: FOR I= 1 TO 2:NEXT I)
  317.  
  318. ----------------------------------------------------------------------
  319. MORE MISC.                              ????????????   ??/??/??    
  320. ---- -----
  321.  
  322. Disable CNTRL/BRK Key
  323.  
  324. DEF SEG=0:POKE 108,83:POKE 109,255:POKE 110,0:POKE 111,240
  325.  
  326. ----------------------------------------------------------------------
  327. ----------------------------------------------------------------------
  328.